package mortal.mvc.core
{	
	import flash.display.*;
	
	import mortal.mvc.events.*;
	import mortal.mvc.interfaces.*;
	
	public class View extends Sprite implements IView
	{
		private var _layer:ILayer;
		protected var _isHide:Boolean = true;
		
		public function View()
		{
		}
		
		public function get isHide() : Boolean
		{
			return this._isHide;
		}
		
		public function set layer(layer:ILayer) : void
		{
			this._layer = layer;
		}
		
		public function get layer() : ILayer
		{
			return this._layer;
		}
		
		public function update(value:Object, ... args) : void
		{
			if (value is int)
			{
			}
			else if (value is Number)
			{
			}
		}
		
		public function hide() : void
		{
			if (this._layer)
			{
				this._isHide = true;
				dispatchEvent(new ViewEvent(ViewEvent.Hide));
				this._layer.removePopup(this);
			}
		}
		
		public function show(X:int = 0, Y:int = 0) : void
		{
			if (this._layer)
			{
				this._isHide = false;
				this._layer.addPopUp(this);
				dispatchEvent(new ViewEvent(ViewEvent.Show));
				if (X != 0 && Y != 0)
				{
					this._layer.setPosition(this, X, Y);
				}
			}
		}
		
		public function dispose() : void
		{
		}
		
	}
}
